#include <vld.h>
#include <QApplication>
#include <QSplashScreen>
#include <Windows.h>

#include "MainWindow.h"
#include "OgreWidget/OgreWidget.h"

int main(int argc, char* argv[])
{
	QApplication app(argc, argv);
	
	// create splash screen
	QSplashScreen* splashScreen = new QSplashScreen;
	splashScreen->setPixmap(QPixmap(":/images/splash.png"));
	splashScreen->show();
	
	// create main window
	Qt::Alignment bottomCenter = Qt::AlignBottom | Qt::AlignHCenter;
	splashScreen->showMessage(QObject::tr("Setting up main window"), bottomCenter, Qt::white);
	
	MainWindow* mainWindow = new MainWindow();

	// initialize engine
	splashScreen->showMessage(QObject::tr("Initializing Engine"), bottomCenter, Qt::white);
//	OgreWidget* ogreWidget = new OgreWidget();
//	mainWindow->setCentralWidget(ogreWidget);
//	ogreWidget->initialize();
//	ogreWidget->showDebugOverlay(true);

	mainWindow->show();
	splashScreen->finish(mainWindow);
	
	// cleanup splashscreen memory
	delete splashScreen;
	
	// run application
	app.exec();

	// free memory
	delete mainWindow;

	return 0;
}